home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.alaska-software.com
/
2014.06.ftp.alaska-software.com.tar
/
ftp.alaska-software.com
/
3pp
/
mxsetup.old
/
{app}
/
MxPshBtn.prg
< prev
next >
Wrap
Text File
|
2001-09-14
|
23KB
|
670 lines
//////////////////////////////////////////////////////////////////////
//
// MxPshBtn.PRG
//
// Copyright:
// Maniacc Software Inc., (c) 2001. All rights reserved.
//
// Contents:
// MxPushButton Class Code substitute for XbpPushButton - provides for
// much more flexible display parameters.
//
//////////////////////////////////////////////////////////////////////
#include "Gra.ch"
#include "Xbp.ch"
#include "Appevent.ch"
#include "Mx.ch"
#include "Common.ch"
#define MX_CAPTION 1
#define MX_POSITION 2
#define MX_SIZE 3
#define MX_FONT 4
#define MX_PARAMS 5
*******************************************************************
* ( MxPushButton ) CLASS DEFINITION
*******************************************************************
CLASS MxPushButton FROM XbpPushButton
HIDDEN:
VAR darkShadowLeft
VAR highlightLeft
VAR darkShadowTop
VAR highlightTop
VAR shadowBottom
VAR darkShadowBottom
VAR shadowRight
VAR darkShadowRight
VAR nColorBG
VAR aCaptions
PROTECTED:
EXPORTED:
VAR aSize
VAR type
VAR captured
VAR drawingArea
VAR oCaption, nCaptionType, captionPos, captionSize, captionFont, CaptionParams
VAR Bitmap, nBitmapType, bitmapPos, bitmapSize, bitmapFont, BitmapParams
VAR Icon, nIconType, iconPos, iconSize, iconFont, IconParams
VAR status
VAR oCaptions
METHOD init, create, destroy, configure
METHOD invert, revert, raise, flatten, clearbuttons
METHOD keyActivate, reset, setStatus
METHOD toFront, toBack
ENDCLASS
*******************************************************************
* ( MxPushButton ) METHOD init
*******************************************************************
METHOD MxPushButton:init( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
::xbpPushButton:init( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
::xbpPushButton:tabstop := .F.
::drawingArea := XbpStatic():new( ::xbpPushButton )
::highlightLeft := XbpStatic():new( ::drawingArea )
::darkShadowLeft := XbpStatic():new( ::drawingArea )
::highlightTop := XbpStatic():new( ::drawingArea )
::darkShadowTop := XbpStatic():new( ::drawingArea )
::shadowBottom := XbpStatic():new( ::drawingArea )
::darkShadowBottom := XbpStatic():new( ::drawingArea )
::shadowRight := XbpStatic():new( ::drawingArea )
::darkShadowRight := XbpStatic():new( ::drawingArea )
::captured := .F.
::type := MX_NONE
::status := MXPB_UP
::caption := ""
::nCaptionType := XBPSTATIC_TYPE_TEXT
::captionPos := {5,5}
::captionSize := {0,0}
::captionFont := ""
::captionParams := aPresParam
::Bitmap := ""
::nBitmapType := XBPSTATIC_TYPE_BITMAP
::BitmapPos := {5,5}
::BitmapSize := {2,2}
::bitmapFont := ""
::bitmapParams := aPresParam
::Icon := 0
::nIconType := XBPSTATIC_TYPE_ICON
::iconPos := {5,5}
::iconSize := {2,2}
::iconFont := ""
::iconParams := aPresParam
::aCaptions := {{::caption,::captionPos,::captionSize,::captionFont,::captionParams},;
{::bitmap,::bitmapPos,::bitmapSize,::bitmapFont,::bitmapParams},;
{::icon,::iconPos,::iconSize,::iconFont,::iconParams}}
::oCaptions := {}
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD create
*******************************************************************
METHOD MxPushButton:create( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
LOCAL oXbp, i, aImageSize, cMsg, lExists := .F.
::aSize := aSize
aAdd(::oCaptions,Nil)
if aPresParam==Nil
aPresParam := {}
endif
if ::captionParams==Nil
::captionParams := {}
endif
if ::bitmapParams==Nil
::bitmapParams := {}
endif
if ::iconParams==Nil
::iconParams := {}
endif
if ::type==MX_NONE
// leave iVar settings alone
elseif ::type==MX_3D
iif(Mx_Debug>9,MxMsgBox(iif(oParent:setColorBG()==Nil,"Nil",str(oParent:setColorBG()))),Nil)
::border := .T.
::status := MXPB_UP
elseif ::type==MX_RAISED
::border := .T.
::status := MXPB_UP
elseif ::type==MX_FLAT
::border := .F.
::status := MXPB_FLAT
elseif ::type==MX_FLYOVER
if !empty(aPresParam)
i := 1
do while i<=len(aPresParam)
if aPresParam[i,1]==XBP_PP_BGCLR
if aPresParam[i,2]==Nil
aPresParam[i,2] := oParent:setColorBG()
lExists := .T.
endif
endif
i++
enddo
endif
if !lExists
aAdd(aPresParam,{XBP_PP_BGCLR,oParent:setColorBG()})
endif
::nColorBG := oParent:setColorBG()
::border := .F.
::status := MXPB_FLAT
endif
::border := iif(::type==MX_FLYOVER,.F.,::border)
*
* If aCaptions has not been populated, put the ::caption, ::bitmap, & ::icon data
* into the array
*
if empty(::aCaptions[1,MX_CAPTION]) // .and. !empty(::caption)
::aCaptions[1,MX_CAPTION] := ::caption
::aCaptions[1,MX_POSITION] := ::captionPos
::aCaptions[1,MX_SIZE] := ::captionSize
::aCaptions[1,MX_FONT] := ::captionFont
::aCaptions[1,MX_PARAMS] := iif(!empty(::captionParams),::captionParams,{})
endif
if empty(::aCaptions[2,MX_CAPTION]) // .and. !empty(::bitmap)
::aCaptions[2,MX_CAPTION] := ::bitmap
::aCaptions[2,MX_POSITION] := ::bitmapPos
::aCaptions[2,MX_SIZE] := ::bitmapSize
::aCaptions[2,MX_FONT] := ::bitmapFont
::aCaptions[2,MX_PARAMS] := iif(!empty(::bitmapParams),::bitmapParams,{})
endif
if empty(::aCaptions[3,MX_CAPTION]) // .and. !empty(::icon)
::aCaptions[3,MX_CAPTION] := ::icon
::aCaptions[3,MX_POSITION] := ::iconPos
::aCaptions[3,MX_SIZE] := ::iconSize
::aCaptions[3,MX_FONT] := ::iconFont
::aCaptions[3,MX_PARAMS] := iif(!empty(::iconParams),::iconParams,{})
endif
*
* Make sure the Pushbutton Size is big enough for all captions
*
for i := 1 to len(::aCaptions)-1
if !empty(::aCaptions[i,MX_CAPTION])
if valtype(::aCaptions[i,MX_CAPTION])=="N".or.(valtype(::aCaptions[i,MX_CAPTION])=="C".and.file(::aCaptions[i,MX_CAPTION]))
if !isBitmap(::aCaptions[i,MX_CAPTION])
aImageSize := IconSize(::aCaptions[i,MX_CAPTION])
else
aImageSize := BitmapSize(::aCaptions[i,MX_CAPTION])
endif
if ::aCaptions[i,MX_SIZE][1]<3
::aCaptions[i,MX_SIZE] := aImageSize
endif
::aSize[1] := iif(::aSize[1]<::aCaptions[i,MX_SIZE][1]+::aCaptions[i,MX_POSITION][1]+5,;
::aCaptions[i,MX_SIZE][1]+::aCaptions[i,MX_POSITION][1]+5,;
aSize[1])
::aSize[2] := iif(::aSize[2]<::aCaptions[i,MX_SIZE][2]+::aCaptions[i,MX_POSITION][2]+5,;
::aCaptions[i,MX_SIZE][2]+::aCaptions[i,MX_POSITION][2]+5,;
aSize[2])
elseif valtype(::aCaptions[i,MX_CAPTION])=="C" .and. ::autoSize
oXbp := MxStatic():new()
oXbp:autoSize := .T.
oXbp:caption := ::aCaptions[i,MX_CAPTION]
oXbp:create(oParent,,{0,0},{0,0},aPresParam,.F.)
::aCaptions[i,MX_SIZE] := oXbp:currentSize()
oXbp:destroy()
::aSize[1] := iif(::autoSize.and.::aSize[1]<::aCaptions[i,MX_SIZE][1]+::aCaptions[i,MX_POSITION][1]+5,;
::aCaptions[i,MX_SIZE][1]+::aCaptions[i,MX_POSITION][1]+5,;
aSize[1])
::aSize[2] := iif(::autoSize.and.::aSize[2]<::aCaptions[i,MX_SIZE][2]+::aCaptions[i,MX_POSITION][2]+5,;
::aCaptions[i,MX_SIZE][2]+::aCaptions[i,MX_POSITION][2]+5,;
aSize[1])
endif
endif
next i
::aCaptions[1,MX_POSITION][1] := iif(::aCaptions[1,MX_POSITION][1]<4,4,::aCaptions[1,MX_POSITION][1])
::aCaptions[1,MX_POSITION][2] := iif(::aCaptions[1,MX_POSITION][2]<5,5,::aCaptions[1,MX_POSITION][2])
::aCaptions[1,MX_SIZE] := iif(::aCaptions[1,MX_SIZE][1]==0,{::aSize[1]-6,::aSize[2]-10},::aCaptions[1,MX_SIZE])
::aCaptions[1,MX_SIZE][1] := iif(::aCaptions[1,MX_SIZE][1]>::aSize[1]-6-::aCaptions[1,MX_POSITION][1],;
::aSize[1]-6-::aCaptions[1,MX_POSITION][1],;
::aCaptions[1,MX_SIZE][1])
::aCaptions[1,MX_SIZE][2] := iif(::aCaptions[1,MX_SIZE][2]>::aSize[2]-6-::aCaptions[1,MX_POSITION][2],;
::aSize[2]-6-::aCaptions[1,MX_POSITION][2],;
::aCaptions[1,MX_SIZE][2])
::xbpPushButton:caption := chr(-1)
::xbpPushButton:create( oParent, oOwner, aPos, ::aSize, aPresParam, lVisible )
::xbpPushButton:killInputFocus := { |uNil1,uNil2,oSelf| ;
iif(::type==MX_FLYOVER,::flatten(),::revert()),;
::captured:=.F.,;
::drawingArea:captureMouse(.F.) }
::xbpPushButton:setSize(::aSize)
::xbpPushButton:setInputFocus := { |uNil1,uNil2,oSelf| ::clearButtons(),iif(::type==MX_FLYOVER,::raise(),::status := MXPB_DOWN) }
::drawingArea:caption := iif(empty(::Bitmap),::caption,"")
::drawingArea:options := XBPSTATIC_TEXT_CENTER + XBPSTATIC_TEXT_VCENTER + XBPSTATIC_TEXT_WORDBREAK
if valtype(::caption)=="C"
::drawingArea:create( ::XbpPushButton, , {0,0}, ::aSize, aPresParam, lVisible )
elseif valtype(::caption)=="N"
::drawingArea:create( ::XbpPushButton, , {0,0}, ::aSize, aPresParam, lVisible )
endif
::drawingArea:lbUp := {|aPos,uNil,oSelf| ;
iif(::status==MXPB_DOWN,PostAppEvent(xbeP_Activate,,,self),Nil),;
::drawingArea:captureMouse(.F.),;
::revert(),;
::status := MXPB_UP }
::drawingArea:lbDown := {|aPos,uNil,oSelf| ;
::drawingArea:captureMouse(.T.),;
::captured := .T.,;
::invert(),;
::status := MXPB_DOWN }
::drawingArea:motion := {|aPos,uNil,oSelf| ::setStatus(aPos) }
::nColorBG := iif(::drawingArea:setColorBG()<>Nil,::drawingArea:setColorBG(),XBPSYSCLR_3DFACE)
for i := 1 to len(::aCaptions)
if !empty(::aCaptions[i,MX_CAPTION])
if valType(::aCaptions[i,MX_CAPTION])=="C".and.!file(::aCaptions[i,MX_CAPTION])
do while len(::oCaptions)<i
aAdd(::oCaptions,Nil)
enddo
::oCaptions[i] := MxStatic():new( ::drawingArea )
::oCaptions[i]:caption := ::aCaptions[i,MX_CAPTION]
::oCaptions[i]:type := XBPSTATIC_TYPE_TEXT
::oCaptions[i]:options := iif(!chr(13)$::aCaptions[i,MX_CAPTION],XBPSTATIC_TEXT_CENTER+XBPSTATIC_TEXT_VCENTER,::drawingArea:options)
iif(!empty(::aCaptions[i,MX_FONT]),::oCaptions[i]:setFontCompoundName(::aCaptions[i,MX_FONT]),Nil)
::oCaptions[i]:create( ::drawingArea,,::aCaptions[i,MX_POSITION],::aCaptions[i,MX_SIZE], ::aCaptions[i,MX_PARAMS] )
::oCaptions[i]:setcolorBG(XBPSYSCLR_TRANSPARENT)
else
do while len(::oCaptions)<i
aAdd(::oCaptions,Nil)
enddo
if IsBitmap(::aCaptions[i,MX_CAPTION]);
.and.::aCaptions[i,MX_SIZE][1]==aImageSize[1];
.and.::aCaptions[i,MX_SIZE][2]==aImageSize[2];
.and.i>1.and.valtype(::aCaptions[i,MX_CAPTION])<>"C"
::oCaptions[i] := MxStatic():new( ::drawingArea )
::oCaptions[i]:caption := ::aCaptions[i,MX_CAPTION]
::oCaptions[i]:type := XBPSTATIC_TYPE_BITMAP
::oCaptions[i]:create( ::drawingArea,,::aCaptions[i,MX_POSITION],::aCaptions[i,MX_SIZE], ::aCaptions[i,MX_PARAMS] )
::oCaptions[i]:setcolorBG(XBPSYSCLR_TRANSPARENT)
elseif !empty(::aCaptions[i,MX_CAPTION])
::oCaptions[i] := AddImage(::drawingArea,;
::aCaptions[i,MX_POSITION],;
::aCaptions[i,MX_SIZE],;
::aCaptions[i,MX_CAPTION])
endif
endif
endif
next i
if !empty(::aCaptions[1,MX_CAPTION])
::oCaption := ::oCaptions[1]
endif
if ::border
::highlightLeft := XbpStatic():new():create( ::drawingArea,,{0,1},{1,::aSize[2]-1},{{XBP_PP_BGCLR,XBPSYSCLR_3DHIGHLIGHT}} )
::darkShadowLeft := XbpStatic():new():create( ::drawingArea,,{1,1},{1,::aSize[2]-2},{{XBP_PP_BGCLR,::nColorBG}} )
::highlightTop := XbpStatic():new():create( ::drawingArea,,{1,::aSize[2]-1},{::aSize[1]-2,1},{{XBP_PP_BGCLR,XBPSYSCLR_3DHIGHLIGHT}} )
::darkShadowTop := XbpStatic():new():create( ::drawingArea,,{1,::aSize[2]-2},{::aSize[1]-3,1},{{XBP_PP_BGCLR,::nColorBG}} )
::shadowBottom := XbpStatic():new():create( ::drawingArea,,{1,1},{::aSize[1]-2,1},{{XBP_PP_BGCLR,XBPSYSCLR_3DSHADOW}} )
::darkShadowBottom := XbpStatic():new():create( ::drawingArea,,{0,0},{::aSize[1],1},{{XBP_PP_BGCLR,iif(::type==MX_RAISED,iif((::nColorBG<8.and.::nColorBG>=0),::nColorBG+8,XBPSYSCLR_3DSHADOW),XBPSYSCLR_BUTTONDARK)}} )
::shadowRight := XbpStatic():new():create( ::drawingArea,,{::aSize[1]-2,1},{1,::aSize[2]},{{XBP_PP_BGCLR,XBPSYSCLR_3DSHADOW}} )
::darkShadowRight := XbpStatic():new():create( ::drawingArea,,{::aSize[1]-1,0},{1,::aSize[2]+1},{{XBP_PP_BGCLR,iif(::type==MX_RAISED,iif((::nColorBG<8.and.::nColorBG>=0),::nColorBG+8,XBPSYSCLR_3DSHADOW),XBPSYSCLR_BUTTONDARK)}} )
elseif ::type==MX_FLYOVER
::highlightLeft := XbpStatic():new():create( ::drawingArea,,{0,1},{1,::aSize[2]-1},{{XBP_PP_BGCLR,::setParent():setcolorBG()}} )
::highlightTop := XbpStatic():new():create( ::drawingArea,,{1,::aSize[2]-1},{::aSize[1]-2,1},{{XBP_PP_BGCLR,::nColorBG}} )
::darkShadowBottom := XbpStatic():new():create( ::drawingArea,,{0,0},{::aSize[1],1},{{XBP_PP_BGCLR,::nColorBG}} )
::darkShadowRight := XbpStatic():new():create( ::drawingArea,,{::aSize[1]-1,0},{1,::aSize[2]+1},{{XBP_PP_BGCLR,::nColorBG}} )
endif
::keyboard := { |nKeyCode,uNil,oSelf| ;
iif(nKeyCode==xbeK_ENTER,::keyActivate(),;
iif(nKeyCode==xbeK_SPACE,;
::reset(oSelf),;
Nil)) }
if ::autoSize .and. ( ::currentSize()[1]<::oCaption:currentSize()[1] .or. ::currentSize()[2]<::oCaption:currentSize()[2] )
::XbpPushbutton:setSize(::oCaption:currentSize())
endif
for i:=1 to len(::drawingArea:childList())
::drawingArea:childList()[i]:motion := ::drawingArea:motion
::drawingArea:childList()[i]:lbUp := ::drawingArea:lbUp
::drawingArea:childList()[i]:lbDown := ::drawingArea:lbDown
for j:= 1 to len(::drawingArea:childList()[i]:childList())
::drawingArea:childList()[i]:childList()[j]:motion := ::drawingArea:motion
::drawingArea:childList()[i]:childList()[j]:lbUp := ::drawingArea:lbUp
::drawingArea:childList()[i]:childList()[j]:lbDown := ::drawingArea:lbDown
next j
next i
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD keyActivate
*******************************************************************
METHOD MxPushButton:keyActivate()
LOCAL lCaptured := ::captured
LOCAL status := ::status
::captured := .T.
::status := MXPB_UP
::invert()
sleep(20)
::revert()
::captured := lCaptured
::status := status
PostAppEvent(xbeP_Activate,,,Self)
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD reset
*******************************************************************
METHOD MxPushButton:reset(oSelf)
LOCAL lCaptured := ::captured
LOCAL status := ::status
setAppFocus(oSelf:setParent())
setAppFocus(oSelf)
::captured := .T.
::status := MXPB_UP
::invert()
sleep(20)
::revert()
::captured := lCaptured
::status := status
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD destroy
*******************************************************************
METHOD MxPushButton:destroy()
::XbpPushButton:destroy()
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD configure
*******************************************************************
METHOD MxPushButton:configure( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
::destroy()
::create( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD SetStatus
*******************************************************************
METHOD setStatus(aPos)
if aPos[1]<=0.or.aPos[1]>=::aSize[1].or.aPos[2]<=0.or.aPos[2]>=::aSize[2]
if ::captured
::drawingArea:captureMouse(.F.)
::captured := .F.
if ::type==MX_FLYOVER
::flatten()
endif
endif
else
if !::captured
::drawingArea:captureMouse(.T.)
::captured := .T.
if ::type==MX_FLYOVER
::raise()
endif
endif
endif
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD invert
*******************************************************************
METHOD MxPushButton:invert()
LOCAL i
if ::border .and. ::captured .and. ::status<>MXPB_DOWN
::highlightLeft:setColorBG(XBPSYSCLR_3DSHADOW)
::darkShadowLeft:setColorBG(XBPSYSCLR_BUTTONDARK)
::highlightTop:setColorBG(XBPSYSCLR_3DSHADOW)
::darkShadowTop:setColorBG(XBPSYSCLR_BUTTONDARK)
::darkShadowBottom:setColorBG(XBPSYSCLR_3DHIGHLIGHT)
::darkShadowRight:setColorBG(XBPSYSCLR_3DHIGHLIGHT)
for i := 1 to len(::oCaptions)-1
if !empty(::aCaptions[i,MX_CAPTION])
::oCaptions[i]:setPos({::aCaptions[i,MX_POSITION][1]+1,::aCaptions[i,MX_POSITION][2]-1})
endif
next i
::status := MXPB_DOWN
elseif ::type==MX_FLYOVER .and. ::captured
::highlightLeft:setColorBG(XBPSYSCLR_3DSHADOW)
::highlightTop:setColorBG(XBPSYSCLR_3DSHADOW)
::darkShadowBottom:setColorBG(XBPSYSCLR_3DHIGHLIGHT)
::darkShadowRight:setColorBG(XBPSYSCLR_3DHIGHLIGHT)
::status := MXPB_DOWN
endif
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD revert
*******************************************************************
METHOD MxPushButton:revert()
if ::border .and. ::captured
::highlightLeft:setColorBG(XBPSYSCLR_3DHIGHLIGHT)
::darkShadowLeft:setColorBG(::nColorBG)
::highlightTop:setColorBG(XBPSYSCLR_3DHIGHLIGHT)
::darkShadowTop:setColorBG(::nColorBG)
::darkShadowBottom:setColorBG(iif(::type==MX_RAISED,iif((::nColorBG<8.and.::nColorBG>=0).or.::nColorBG<-53,::nColorBG+8,XBPSYSCLR_3DSHADOW),XBPSYSCLR_BUTTONDARK))
::darkShadowRight:setColorBG(iif(::type==MX_RAISED,iif((::nColorBG<8.and.::nColorBG>=0).or.::nColorBG<-53,::nColorBG+8,XBPSYSCLR_3DSHADOW),XBPSYSCLR_BUTTONDARK))
::status := MXPB_UP
for i := 1 to len(::oCaptions)-1
if !empty(::aCaptions[i,MX_CAPTION])
::oCaptions[i]:setPos(::aCaptions[i,MX_POSITION])
endif
next i
elseif ::type==MX_FLYOVER .and. ::captured
::highlightLeft:setColorBG(::nColorBG)
::highlightTop:setColorBG(::nColorBG)
::darkShadowBottom:setColorBG(::nColorBG)
::darkShadowRight:setColorBG(::nColorBG)
::status := MXPB_UP
endif
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD raise
*******************************************************************
METHOD MxPushButton:raise()
::highlightLeft:setColorBG(XBPSYSCLR_3DHIGHLIGHT)
::highlightTop:setColorBG(XBPSYSCLR_3DHIGHLIGHT)
::darkShadowBottom:setColorBG(XBPSYSCLR_3DSHADOW)
::darkShadowRight:setColorBG(XBPSYSCLR_3DSHADOW)
::status := MXPB_UP
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD flatten
*******************************************************************
METHOD MxPushButton:flatten()
::highlightLeft:setColorBG(iif(::setparent():setcolorBG()<>Nil,::setparent():setcolorBG(),::nColorBG))
::highlightTop:setColorBG(iif(::setparent():setcolorBG()<>Nil,::setparent():setcolorBG(),::nColorBG))
::darkShadowBottom:setColorBG(iif(::setparent():setcolorBG()<>Nil,::setparent():setcolorBG(),::nColorBG))
::darkShadowRight:setColorBG(iif(::setparent():setcolorBG()<>Nil,::setparent():setcolorBG(),::nColorBG))
::status := MXPB_FLAT
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD clearButtons
*******************************************************************
METHOD clearButtons()
LOCAL aChildren := ::setParent():childlist()
LOCAL i
for i := 1 to len(aChildren)
if aChildren[i]:isderivedFrom("MxPushbutton").and.aChildren[i]:type==MX_RAISED.and.aChildren[i]:type==MX_FLYOVER
aChildren[i]:flatten()
aChildren[i]:drawingArea:captureMouse(.F.)
endif
next i
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD toFront
*******************************************************************
METHOD MxPushButton:toFront()
if ::clipsiblings
::XbpPushButton:toFront()
else
::XbpPushButton:toBack()
endif
RETURN self
*******************************************************************
* ( MxPushButton ) METHOD toBack
*******************************************************************
METHOD MxPushButton:ToBack()
if ::clipsiblings
::XbpPushButton:toBack()
else
::XbpPushButton:toFront()
endif
RETURN self
*******************************************************************
* FUNCTION MxPshBtn() - Wrapper for MxPushButton Class
*******************************************************************
FUNCTION MxPshBtn( oParent, oOwner, aPos, aSize, aPresParam, lVisible, nType, aCaption, aBitmap, aIcon )
// Notes: aCaption = { Caption, captionPos, captionSize, captionFont }
// aBitmap = { Bitmap, bitmapPos, bitmapSize, bitmapFont }
// aIcon = { Icon, iconPos, iconSize, iconFont }
// nType = MX_NONE, MX_3D, MX_RAISED, MX_FLAT or MX_FLYOVER
LOCAL oXbp
default aIcon to {"",Nil,Nil}
oXbp := MxPushButton():new()
oXbp:type := nType
oXbp:caption := iif(empty(aCaption[1]),"",aCaption[1])
oXbp:CaptionPos := aCaption[2]
oXbp:CaptionSize := aCaption[3]
oXbp:CaptionFont := aCaption[4]
oXbp:Bitmap := iif(empty(aBitmap[1]),"",aBitmap[1])
oXbp:BitmapPos := aBitmap[2]
oXbp:BitmapSize := aBitmap[3]
oXbp:Icon := iif(empty(aIcon[1]),"",aIcon[1])
oXbp:IconPos := aIcon[2]
oXbp:IconSize := aIcon[3]
oXbp:create( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
RETURN oXbp
*******************************************************************
* FUNCTION MxCloseBtn() - Emulate a Close Button
*******************************************************************
FUNCTION MxCloseBtn( oParent, oOwner, aPos, aSize )
LOCAL oXbp
DEFAULT oParent to SetAppWindow()
DEFAULT oOwner to oParent
DEFAULT aPos to {oParent:currentSize()[1]-18,oParent:currentSize()[2]-18}
DEFAULT aSize to {17,17}
oXbp := XbpPushButton():new()
oXbp:caption := chr(114)
oXbp:activate := { || PostAppEvent( xbeP_Close ) }
oXbp:create( oParent, oOwner, aPos, aSize, {{XBP_PP_COMPOUNDNAME,"8.Marlett"}} )
RETURN oXbp